//
//  YWBuildingManager.h
//  maintain
//
//  Created by 郑想 on 15/10/29.
//  Copyright © 2015年 ewin. All rights reserved.
//

#import "YWSingleton.h"
#import <Foundation/Foundation.h>

@class YWBuilding;
@class YWEquipment;
@class YWLocation;
@class YWFloor;
@class YWApartment;
@class YWHandler;

@interface YWBuildingManager : NSObject

YWSingletonH(Manager)

/**
 *  保存楼盘相关数据
 *
 *  @param buildingsJsonArray 楼盘相关数据对象
 */
- (void)savebuildingJsonWithArray : (NSArray*)buildingJsonArray;
//更新
- (void)updatebuildingJsonWithArray:(NSArray*)buildingJsonArray;
/**
 *  获取楼盘信息
 *
 *  @param buildingId 楼盘Id
 *
 *  @return 楼盘模型
 */
- (YWBuilding*)buildingWithId:(NSString*)buildingId;
/**
 *  获取楼盘信息
 *
 *  @param locationId 层位置Id
 *
 *  @return 楼盘模型
 */
- (YWBuilding*)buildingWithLocationId:(NSInteger)locationId;
/**
 *  获取楼盘信息
 *
 *  @param locations 层位置模型数组
 *
 *  @return 楼盘模型
 */
- (YWBuilding*)buildingWithLocations:(NSArray*)locations;
/**
 *  所有的楼盘Id
 *
 *  @return 楼盘Id用逗号隔开
 */
- (NSString*)allBuildingId;
/**
 *  所有的楼盘
 *
 *  @return 楼盘数组
 */
- (NSArray*)allBuilding;
/**
 *  获取楼盘的楼栋
 *
 *  @param buildingId 楼盘Id
 *
 *  @return 楼栋模型数组
 */
- (NSArray*)apartmentWithbuildingId:(NSString*)buildingId;
/**
 *  获取楼栋的楼层
 *
 *  @param apartmentId 楼栋Id
 *
 *  @return 楼层模型数组
 */
- (NSArray*)floorWithApartmentId:(NSInteger)apartmentId;
/**
 *  获取楼层的层位置
 *
 *  @param floorId 楼层Id
 *
 *  @return 层位置模型数组
 */
- (NSArray*)locationWithFloorId:(NSInteger)floorId;

/**
 *  按条件筛选查询位置
 *
 *  @param buildingId 楼盘Id
 *  @param apartmentId 楼栋Id
 *  @param floorId 楼层Id
 *  @param page 页数
 *
 *  @return 层位置模型数组
 */
- (NSArray*)locationWithBuildingId:(NSString*)buildingId apartmentId:(NSInteger)apartmentId floorId:(NSInteger)floorId page:(NSInteger)page;

/**
 *  查询楼盘
 *
 *  @param lineId 线路Id
 *  @param isKeepWatch 是否是巡更
 *  @param isEquipmentLine 是位置路线还是设备路线
 *
 *  @return 结果
 */
- (NSArray *)buildingArrayWithLineId:(NSInteger)lineId type:(BOOL)isKeepWatch lineType:(BOOL)isEquipmentLine;
/**
 *  查询楼栋
 *
 *  @param buildingId 楼盘Id
 *  @param lineId 线路Id
 *  @param isKeepWatch 是否是巡更
 *  @param isEquipmentLine 是位置路线还是设备路线
 *
 *  @return 结果
 */
- (NSArray *)apartmentArrayWithBuildingId:(NSString*)buildingId LineId:(NSInteger)lineId type:(BOOL)isKeepWatch lineType:(BOOL)isEquipmentLine;
/**
 *  查询楼层
 *
 *  @param apartmentId 楼栋Id
 *  @param lineId 线路Id
 *  @param isKeepWatch 是否是巡更
 *  @param isEquipmentLine 是位置路线还是设备路线
 *
 *  @return 结果
 */
- (NSArray *)floorArrayWithApartmentId:(NSInteger)apartmentId LineId:(NSInteger)lineId type:(BOOL)isKeepWatch lineType:(BOOL)isEquipmentLine;
/**
 *  查询位置
 *
 *  @param floorId 楼层Id
 *  @param lineId 线路Id
 *  @param isKeepWatch 是否是巡更
 *  @param isEquipmentLine 是位置路线还是设备路线
 *
 *  @return 结果
 */
- (NSArray *)locationArrayWithfloorId:(NSInteger)floorId LineId:(NSInteger)lineId type:(BOOL)isKeepWatch lineType:(BOOL)isEquipmentLine;

/**
 *  检测保养任务过滤位置()
 *
 *  @param missionId 任务Id
 *  @param equipmentTypeId 设备类型Id
 *  @param positionType 查询什么类型的位置(1:楼盘/2:楼栋/3:楼层/4:位置)
 *  @param buildingId 楼盘Id
 *  @param apartmentId 楼栋Id
 *  @param floorId 楼层Id
 *
 *  @return 楼盘/楼栋/楼层/位置
 */
- (NSArray *)selectPositionWithMissionId:(NSInteger)missionId equipmentTypeId:(NSInteger)equipmentTypeId positionType:(NSInteger)positionType buildingId:(NSString *)buildingId apartmentId:(NSInteger)apartmentId floorId:(NSInteger)floorId;

/**
 *  获取层位置
 *
 *  @param locationId 层位置Id
 *
 *  @return 层位置模型
 */
- (YWLocation*)locationWithId:(NSInteger)locationId;
- (YWFloor*)floorWithId:(NSInteger)floorId;
- (YWApartment*)apartmentWithId:(NSInteger)apartmentId;

- (YWBuilding*)buildingWithEquipmentId:(NSString*)equipmentId;
/**
 *  获取设备的位置 (包括楼盘)
 *
 *  @param equipment 设备模型
 *
 *  @return 位置信息
 */
- (NSString*)equipmentLocation:(YWEquipment*)equipment;
/**
 *  获取设备的位置 (不包括楼盘)
 *
 *  @param equipment 设备模型
 *
 *  @return 位置信息
 */
- (NSString*)equipmentLocationNobuilding:(YWEquipment*)equipment;

/**
 *  获取区域位置(包括楼盘)
 *
 *  @param locations 层位置模型数组
 *
 *  @return 位置信息
 */
- (NSString*)areaLocation:(NSArray*)locations;
/**
 *  获取区域位置(不包括楼盘)
 *
 *  @param locationId 层位置Id
 *
 *  @return 位置信息
 */
- (NSString*)areaLocationNobuildingWithId:(NSInteger)locationId;
/**
 *  获取区域位置(包括楼盘)
 *
 *  @param locationId 层位置Id
 *
 *  @return 位置信息
 */
- (NSString*)areaLocationWithLocationId:(NSInteger)locationId;
/**
 *  获取区域位置(不包括楼盘)
 *
 *  @param locations 层位置模型数组
 *
 *  @return 位置信息
 */
- (NSString*)areaLocationNobuilding:(NSArray*)locations;

@end
